# -*- coding: utf-8 -*-
# ----------------------------
# @Time    : 2021/7/4 3:54 下午
# @Author  : changqingai
# @FileName: 03-broadcast.py
# ----------------------------

from pyspark import SparkContext

if __name__ == "__main__":
    sc = SparkContext(master='local[2]', appName="broadcast")
    word_broadcast = sc.broadcast(["spark", "scala", "java", "python", "hadoop"])
    data = word_broadcast.value
    print('data', data)
    print('data[2]', word_broadcast.value[2])
